<script>
    async function loginAxios(url,param,historypath){
         return new Promise((resolve, reject) => {
             var token=localStorage.getItem("UserToken") ;
             if(!token){
                 router.push({ path: '/login', query: { historypath:historypath}});
             }
             axios.post(url,param,
                {
                    headers: {
                    'token': localStorage.getItem("UserToken") 
                    }
                }).then(res=>{
                    if(res.data.message=="401"){
                          router.push({ path: '/login', query: { historypath:historypath}});
                        }
                    if(res.data&&res.data.data&&res.data.status){
                       resolve(res.data.data);
                    }
                    else{
                     resolve(null)
                    }           
                });
         });
    }
import axios from "axios";
import router from '@/router';
export default {
    loginAxios
}
</script>